home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / DMToolWizard.awx / TEMPLATE / CLASSNAMEPROP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-11  |  4.1 KB  |  146 lines

  1. //------------------------------------------------------------------------------
  2. // File: $$CLASS_NAME$$Prop.cpp
  3. //
  4. // Desc: DirectMusicTool Wizard generated code - Implementation of
  5. //         $$CLASS_NAME$$Prop
  6. //
  7. // Copyright (c) Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10. /////////////////////////////////////////////////////////////////////////////
  11. // TODO List: (Functions that are only partially implemented)
  12. //  - OnInitDialog()
  13. //    - Apply()
  14. //
  15. /////////////////////////////////////////////////////////////////////////////
  16.  
  17.  
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif // _MSC_VER > 1000
  21.  
  22. #define STRICT
  23. #ifndef _WIN32_WINNT
  24. #define _WIN32_WINNT 0x0400
  25. #endif
  26.  
  27. #define _ATL_APARTMENT_THREADED
  28. #define _ATL_STATIC_REGISTRY
  29.  
  30. #include <atlbase.h>
  31. //You may derive a class from CComModule and use it if you want to override
  32. //something, but do not change the name of _Module
  33. extern CComModule _Module;
  34. #include <atlcom.h>
  35. #include <atlctl.h>
  36. #include <statreg.h>
  37. #include <statreg.cpp>
  38. #include <atlimpl.cpp>
  39.  
  40.  
  41. #include "$$CLASS_NAME$$.h"
  42. #include "$$CLASS_NAME$$Prop.h"
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // $$CLASS_NAME$$Prop
  46.  
  47. $$CLASS_NAME$$Prop::$$CLASS_NAME$$Prop() 
  48. {
  49.     m_dwTitleID = IDS_TITLE_$$TOOL_DEFINE$$PROP;            // TODO: Define this in the resource file
  50.     m_dwHelpFileID = IDS_HELPFILE_$$TOOL_DEFINE$$PROP;        // TODO: Define this in the resource file
  51.     m_dwDocStringID = IDS_DOCSTRING_$$TOOL_DEFINE$$PROP;    // TODO: Define this in the resource file
  52.     m_p$$INTERFACE_NAME$$ = NULL;
  53. }
  54.  
  55. STDMETHODIMP $$CLASS_NAME$$Prop::SetObjects(ULONG cObjects,IUnknown **ppUnk)
  56. {
  57.     if (cObjects != 1)
  58.     {
  59.         return E_UNEXPECTED;
  60.     }
  61.  
  62.     return ppUnk[0]->QueryInterface(IID_$$INTERFACE_NAME$$,(void **) &m_p$$INTERFACE_NAME$$);
  63. }
  64.  
  65.  
  66. STDMETHODIMP $$CLASS_NAME$$Prop::Apply(void)
  67. {
  68.     if (!m_p$$INTERFACE_NAME$$)
  69.     {
  70.         return E_UNEXPECTED;
  71.     }
  72.  
  73.     $$TOOLID_NAME$$Params params;
  74.     ZeroMemory(¶ms, sizeof($$TOOLID_NAME$$Params));
  75.  
  76. $$IF(EMPTY_TOOL)
  77. // TODO: Get parameter values from the controls
  78.     // Example:
  79.     params.dwParam1 = static_cast<DWORD>(m_ctValue1.GetValue());
  80.     // End of Example
  81. $$ELSE // Sample DMTool
  82.     params.dwNumber = static_cast<DWORD>(m_ctValue1.GetValue());
  83.     params.dwDelay = static_cast<DWORD>(m_ctValue2.GetValue());
  84. $$ENDIF
  85.  
  86.     HRESULT hr = m_p$$INTERFACE_NAME$$->SetAllParameters(¶ms);
  87.  
  88.     if (FAILED(hr))
  89.     {
  90.         return hr;
  91.     }
  92.  
  93.     m_bDirty = FALSE;
  94.     return S_OK;
  95. }
  96.  
  97. LRESULT $$CLASS_NAME$$Prop::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  98. {
  99.     if(m_p$$INTERFACE_NAME$$)
  100.     {
  101.         $$TOOLID_NAME$$Params params;
  102.         ZeroMemory(¶ms, sizeof($$TOOLID_NAME$$Params));
  103.         m_p$$INTERFACE_NAME$$->GetAllParameters(¶ms);
  104.  
  105. $$IF(EMPTY_TOOL)
  106.     // TODO: Initialize controls and their values.
  107.         // Example:
  108.         m_ctValue1.Init(GetDlgItem(IDC_SLIDER1),GetDlgItem(IDC_SLIDER1_DISPLAY),0,100,true);
  109.         m_ctValue1.SetValue(static_cast<float>(params.dwParam1));
  110.         // End of Example
  111. $$ELSE // Sample DMTool
  112.         m_ctValue1.Init(GetDlgItem(IDC_SLIDER1),GetDlgItem(IDC_SLIDER1_DISPLAY),1,4,true);
  113.         m_ctValue1.SetValue(static_cast<float>(params.dwNumber));
  114.  
  115.         m_ctValue2.Init(GetDlgItem(IDC_SLIDER2),GetDlgItem(IDC_SLIDER2_DISPLAY),0,1000,true);
  116.         m_ctValue2.SetValue(static_cast<float>(params.dwDelay));
  117. $$ENDIF
  118.  
  119.     }
  120.     return 1;
  121. }
  122.  
  123. LRESULT $$CLASS_NAME$$Prop::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  124. {
  125.     LRESULT lr = m_ctValue1.MessageHandler(uMsg, wParam,lParam, bHandled);
  126. $$IF(!EMPTY_TOOL) // Sample DMTool
  127.     if(!bHandled)
  128.         lr = m_ctValue2.MessageHandler(uMsg, wParam,lParam, bHandled);
  129. $$ENDIF
  130.     if (bHandled)
  131.         SetDirty(true);
  132.     return lr;
  133. }
  134.  
  135. LRESULT $$CLASS_NAME$$Prop::OnControlMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  136. {
  137.     LRESULT lr = m_ctValue1.MessageHandler(uMsg, wParam,lParam, bHandled);
  138. $$IF(!EMPTY_TOOL) // Sample DMTool
  139.     if(!bHandled)
  140.         lr = m_ctValue2.MessageHandler(uMsg, wParam,lParam, bHandled);
  141. $$ENDIF
  142.     if (bHandled)
  143.         SetDirty(true);
  144.     return lr;
  145. }
  146.